package org.example.job;

import org.example.domain.TDepartment;
import org.example.mapper.DepartmentMapper;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;

import java.util.List;

/**
 * 定时任务业务处理类，我们继承QuartzJobBean
 * 重写executeInternal方法来实现具体的定时业务逻辑
 */
public class QueryAllDeptsJob extends QuartzJobBean {
    @Autowired
    private DepartmentMapper departmentMapper;

    @Override
    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
        List<TDepartment> departments = departmentMapper.selectAll();
        System.out.println(">>>>>>>>>>>查询的部门列表结果：" + departments);

    }
}
